/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */



function loadForums(){
    sendAJAXRequest('../../src/Servlets/PortalServlet.php', loadForumsReceieve, 'action=loadForums');
}


function loadForumsReceieve(jsonObj){
    var output = '';
    if (jsonObj == null){
        output = '<p class="errorMsg"> There is no forums </p>';
    }
    else {
    output = '<table border="1" class="forumsTable" >';
    output += '<tr>';
    output += '<th>';
    output += 'Forum Name';
    output += '</th>';
    output += '<th>';
    output += 'Description';
    output += '</th>';
    output += '<th>';
    output += 'Creation Date';
    output += '</th>';
    output += '</tr>';

    for (var i = 0; i < jsonObj.length; i++) {
        output += '<tr>';
        output += '<td align="center"><a href="../pages/Forum.php?forumID=' + jsonObj[i].ID + '&forumName=' + jsonObj[i].FORUM_NAME + '">';
        output += jsonObj[i].FORUM_NAME;
        output += '</a></td>';
        output += '<td align="center">';
        output += jsonObj[i].DESCRIPTION;
        output += '</td>';
        output += '<td align="center">';
        output += jsonObj[i].CREATION_DATE;
        output += '</td>';
        output += '</tr>';
    }

    output += '</table>';
    }
    document.getElementById("forumsDiv").innerHTML = output;

}







